package com.sophialex.health.record.common.dialog;

import java.util.List;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;

import com.sophialex.health.record.common.Messages;
import com.sophialex.health.system.frame.assist.CommonAssist;


public class DrugLocateCommonAssist<T> extends CommonAssist{

	private Text ypmcText;
	private Text ggText;
	private Text dwText;
	private Text lsjText;

	
	public DrugLocateCommonAssist(Text text, String property,List list,Text ypmcText,Text ggText
			,Text dwText,Text lsjText) {
		super(text, property);
		proStr = new String[] { "fypbh", "fypmc", "fstandard" ,"fkfunitname"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
		this.list = list;
		this.ypmcText=ypmcText;
		this.ggText=ggText;
		this.dwText=dwText;
		this.lsjText=lsjText;

	}

	@Override
	protected void createColumn() {
		// TODO Auto-generated method stub
		{
			TableColumn column = new TableColumn(table, SWT.NONE);
			column.setWidth(100);
			column.setText(Messages.DrugLocateCommonAssist_0);
		}
		{
			TableColumn column = new TableColumn(table, SWT.NONE);
			column.setWidth(100);
			column.setText(Messages.DrugLocateCommonAssist_1);
		}
		{
			TableColumn column = new TableColumn(table, SWT.NONE);
			column.setWidth(100);
			column.setText(Messages.DrugLocateCommonAssist_2);
		}
		{
			TableColumn column = new TableColumn(table, SWT.NONE);
			column.setWidth(100);
			column.setText(Messages.DrugLocateCommonAssist_3);
		}
		dbTable.setColumnProperties(proStr);
		dbTable.exeDbTable(DrugsCommonBean.class);
		filterPro = new String[]{"fypbh", "fypmc", "fstandard" ,"fkfunitname","fmalias","fzjcpy","fzjcwb","fzjcqt"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
		cpt.setFilterStr(filterPro);
	}

	@Override
	public void updateControl(Object o) {
		// TODO Auto-generated method stub
		super.updateControl(o);
		if(text.getData()==null)
			return;
//		KczQuery mx=(KczQuery) text.getData();
//		ypmcText.setText(mx.getFypmc()==null?"":mx.getFypmc());
//		ggText.setText(mx.getFstandard()==null?"":mx.getFstandard());
//		dwText.setText(mx.getFkfunitname()==null?"":mx.getFkfunitname());
		DrugsCommonBean bean = (DrugsCommonBean) text.getData();
		ypmcText.setText(bean.getFypmc()==null?"":bean.getFypmc()); //$NON-NLS-1$
		ggText.setText(bean.getFstandard()==null?"":bean.getFstandard()); //$NON-NLS-1$
		dwText.setText(bean.getFkfunitname()==null?"":bean.getFkfunitname()); //$NON-NLS-1$

	}

	@Override
	public Point getInitialSize() {
		// TODO Auto-generated method stub
		return new Point(600, 300);
	}

}
